package mashuaiproject.mashuaiproject.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

@Component
public interface DelMapper {
    @Delete("delete   from clickfabulou where  comment_id=#{delId} and user_id=#{id}")
    int delFabuloud(@Param("delId") Integer delId, @Param("id") Integer id);

    @Select("select fabulous_up from comment where id=#{id}")
    int selectFabulousUp(@Param("id") Integer id);

    @Select("select fabulous_down from comment where id=#{id}")
    int selectFabulousDown(@Param("id") Integer id);
    //防止恶意删除
    @Delete("delete  from comment where id=#{delId} and commentator=#{id}")
    int delComments(@Param("delId") Integer delId,@Param("id")Integer id);

    @Select("select commentson_count from comment where id=#{id}")
    int selectCommentSonCout(Integer delId);

    @Delete("delete  from commentson where father_id=#{delId}")
    int delCommentSon(Integer delId);

    @Select("select  count(1) from notification where comment_id=#{delId}")
    int selectNotifi(@Param("delId") Integer delId);

    @Delete("delete  from notification where comment_id=#{delId}")
    int delNotifis(@Param("delId") Integer delId);
}
